sched_rt: serialize vcpu data access
authorMeng Xu <mengxu@cis.upenn.edu>
Wed, 12 Nov 2014 11:36:04 +0000 (12:36 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 12 Nov 2014 11:36:04 +0000 (12:36 +0100)
commit802b778e9aad55ebc202f581046ad978b8620c2e
tree86e9a87874025650aff6bf574810a929436433ea
parent9f9ccbbacc0cdda1dd41c2e36b3fb622e434dc13
sched_rt: serialize vcpu data access

Fix the following two issues in rtds scheduler:
1) The runq queue lock is not grabbed when rt_update_deadline is
called in rt_alloc_vdata function, which may cause race condition;
Solution: Move call to rt_update_deadline from _alloc to _insert;
Note: rt_alloc_vdata does not need grab the runq lock, because only one
cpu will allocate the rt_vcpu; before the rt_vcpu is inserted into the
runq, no more than one cpu operates on the rt_vcpu.

2) rt_vcpu_remove should grab the runq lock before remove the vcpu
from runq; otherwise, race condition may happen.
Solution: Add lock in rt_vcpu_remove().

Reported-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Meng Xu <mengxu@cis.upenn.edu>
Reviewed-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: George Dunlap <george.dunlap@eu.citrix.com>
Release-Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
xen/common/sched_rt.c